-- background: 2543 from stack: in.1 ееее -- bmap block id: 4875 -- flags: 0000 -- background id: 0 -- name: Playing Grounds ----- HyperTalk script ----- on idle global secsOffset, newWord, gameState, playingTime --put gameState if gameState = "clockRunning" then put 0 into m if the visible of field "Screen Mask" is true then exit idle end if put playingTime-(the secs-secsOffset) into s put s div 60 into m put s mod 60 into s if s < 10 then put "0" before s if playingTime-(the secs-secsOffset) < 0 then setGameState "clockRanOut" else put m & ":" & s into field Timer put newWord into field "New Word" end if else if gameState = "clockRanOut" then play "harpsichord" tempo 1000 "c5 d e f g a b c6" setGameState "readyToScore" end if --put gameState end idle on handleCubeClick global newWord, gameState if gameState = "clockRunning" then put param(1) into buttonName if the optionKey is down then repeat while the mouse is down set the location of bkgnd button buttonName to the mouseloc end repeat else if the shiftKey is down then set the hilite of bkgnd button buttonName to false put length(newWord) into l if l = 1 then put 0 into m else put 1 into m put char m to l-1 of newWord into newWord else play "Harpsichord" tempo 1000 "e6" if the hilite of bkgnd button buttonName is false then put char 15 of the name of bkgnd button buttonName after newWord set the hilite of bkgnd button buttonName to true else errorSound end if end if end if end handleCubeClick on gameOver global newWord, gameState answer "Congratulations, " & field Username & ", you win!" with "Done" or "Play again" put it into theAnswer setGameState "gameOver" if theAnswer is "Done" then resetGame go card "Welcome" else newGame end if end gameOver on newGame global gameState set cursor to 4 set lockscreen to true go card "Player 1" put 0 into field Score go next card put 2 into i repeat if (the name of this card) = "card " & quote & "HQ Preferences" & quote then exit repeat end if put 0 into field Score put empty into field "New Word" add 1 to i go next card end repeat go card "Player 1" hide bkgnd button 11 hide bkgnd button 12 hide bkgnd button 13 show field "3 Letter Words" setGameState "readyToPlay" end newGame on returnKey global gameState if the message box is empty or the visible of the message box is false then if gameState = "readyToScore" then set the hilite of bkgnd button "Score" to true set the hilite of bkgnd button "Score" to false send mouseUp to bkgnd button "Score" exit returnKey end if if gameState = "readyToPlay" then set the hilite of bkgnd button "New Roll" to true set the hilite of bkgnd button "New Roll" to false send mouseUp to bkgnd button "New Roll" exit returnKey end if if gameState = "justOpened" or gameState = "gameOver" then set the hilite of bkgnd button "New Game" to true set the hilite of bkgnd button "New Game" to false send mouseUp to bkgnd button "New Game" exit returnKey end if else do the message box end returnKey on enterKey returnKey end enterKey on arrowKey errorSound end arrowKey on handleRoll put param(1) into buttonName put param(2) into letters set the name of bkgnd button buttonName to any char of letters set the hilite of bkgnd button buttonName to false end handleRoll on setGameState newState global gameState put newState into gameState if gameState = "gameOver" or gameState = "justOpened" then set the name of bkgnd button id 50 to "Press Return to start a new game" show bkgnd button id 50 else if gameState = "readyToPlay" then set the name of bkgnd button id 50 to "Press Return to roll the dice" show bkgnd button id 50 else if gameState = "readyToScore" then set the name of bkgnd button id 50 to "Press Return to score the round" show bkgnd button id 50 else if gameState = "clockRunning" then hide bkgnd button id 50 end if end setGameState -- part 1 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=84 top=219 right=241 bottom=108 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: J ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "JXEZVQ" end Roll -- part 2 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=110 top=216 right=238 bottom=133 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: B ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "RKHTBI" end Roll -- part 4 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=149 top=219 right=241 bottom=172 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: U ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "TIFPNU" end Roll -- part 5 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=175 top=213 right=235 bottom=199 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: O ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "WLBOOY" end Roll -- part 8 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=85 top=243 right=265 bottom=108 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: C ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "COPMOW" end Roll -- part 9 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=112 top=249 right=271 bottom=135 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: N ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "TODLNR" end Roll -- part 10 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=140 top=245 right=267 bottom=163 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: E ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "AAAEEE" end Roll -- part 11 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=179 top=241 right=263 bottom=202 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: A ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "AAAEEE" end Roll -- part 12 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=81 top=276 right=298 bottom=104 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: U ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "SUIRGM" end Roll -- part 13 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=116 top=277 right=299 bottom=139 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: U ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "HIFSUR" end Roll -- part 7 (button) -- low flags: 80 -- high flags: 8004 -- rect: left=145 top=277 right=300 bottom=170 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: C ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "GDCJMK" end Roll -- part 3 (button) -- low flags: 80 -- high flags: 8004 -- rect: left=171 top=272 right=295 bottom=196 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Q ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "WVSSQY" end Roll -- part 6 (button) -- low flags: 80 -- high flags: 8004 -- rect: left=88 top=309 right=332 bottom=113 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: B ----- HyperTalk script ----- on mouseDown handleCubeClick (the number of me) end mouseDown on Roll handleRoll (the number of me), "PFNHLB" end Roll -- part 14 (button) -- low flags: 00 -- high flags: A003 -- rect: left=341 top=243 right=263 bottom=396 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Score ----- HyperTalk script ----- on mouseUp global gameState, numPlayers, curPlayer, vulScore, winningScore if gameState = "readyToScore" then put field Score into savedScore repeat with i = 3 to 10 do "send Score to field " & quote & i & " Letter Words" & quote end repeat if savedScore ≥ vulScore then --if vulnerable, check score above 500 if field Score - savedScore < 500 then put savedScore - 500 into field Score end if end if put "-:--" into field Timer if field Score ≥ winningScore then gameOver else set lockscreen to true go next card if (the name of this card) ≠ "card " & quote & "HQ Preferences" & quote then answer "Get ready for the next roll!" with "OK" go previous card set lockscreen to false visual effect scroll left go next card else answer "Get ready for the next roll!" with "OK" go previous card set lockscreen to false visual effect scroll right go card "Player 1" end if setGameState "readyToPlay" end if end if --put gameState end mouseUp -- part 15 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=342 top=199 right=220 bottom=501 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Clear word in progress ----- HyperTalk script ----- on mouseUp global newWord put empty into newWord put empty into field "New Word" repeat with i = 1 to 13 set the hilite of bkgnd button i to false end repeat end mouseUp -- part 16 (button) -- low flags: 00 -- high flags: A003 -- rect: left=341 top=265 right=285 bottom=415 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: New Roll ----- HyperTalk script ----- on mouseUp global secsOffset, gameState, newWord, vulScore --put gameState if gameState = "justOpened" then send mouseUp to bkgnd button "New Game" end if if gameState = "readyToPlay" then set cursor to 4 -- check for vulnerability if field "Score" ≥ vulScore then show bkgnd button 11 show bkgnd button 12 show bkgnd button 13 hide field "3 Letter Words" end if -- clear out word lists repeat with i = 3 to 10 do "put empty into field " & quote & i & " Letter Words" & quote end repeat play "harpsichord" tempo 70 "c4 c c c c5 c c c" resetCubes put empty into newWord put empty into field "New Word" put the secs into secsOffset setGameState "clockRunning" else if gameState = "clockRanOut" or gameState = "readyToScore" then answer "Please score this roll first." with "OK" end if end if --put gameState end mouseUp on resetCubes put 0 into j put 0 into k repeat with i = 1 to 13 send Roll to bkgnd button i put random(10) into r1 put random(10) into r2 set the location of bkgnd button i to 90+30*k+r1, 220+30*j+r2 if i mod 4 = 0 then add 1 to j put 0 into k else add 1 to k end if end repeat end resetCubes -- part 17 (button) -- low flags: 00 -- high flags: 8004 -- rect: left=342 top=152 right=197 bottom=501 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Word ----- HyperTalk script ----- on mouseUp global newWord, gameState put length(newWord) into wLen if wLen ≥ 3 and wLen ≤ 10 and gameState = "clockRunning" then -- set lockscreen to true put quote & wLen & " Letter Words" & quote into fName if wLen > 3 and char wLen of newWord = "S" then put quote & wLen-1 & " Letter Words" & quote into singularFName do "put field " & singularFName & "into temp1" put (char 1 to (wLen-1) of newWord) into singularWord else put "!" into temp1 put "%" into singularWord end if do "put field " & fName & "into temp2" if offset(newWord, temp2) = 0 and offset(singularWord, temp1) = 0 then do "put newWord & return after field " & fName wordSound do "put the number of lines in field " & fName & " into temp" if temp ≥ 5 then wordSound end if else errorSound else errorSound put empty into newWord repeat with i = 1 to 13 set the hilite of bkgnd button i to false end repeat set the cursor to 0 end mouseUp on wordSound play "harpsichord" tempo 1500 "c4 e5 g6" end wordSound -- part 20 (field) -- low flags: 01 -- high flags: 0002 -- rect: left=341 top=291 right=316 bottom=415 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 18 -- style flags: 0 -- line height: 24 -- part name: Score -- part 21 (field) -- low flags: 01 -- high flags: 0002 -- rect: left=5 top=152 right=171 bottom=170 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 256 -- line height: 16 -- part name: New Word -- part 22 (field) -- low flags: 00 -- high flags: 4002 -- rect: left=5 top=81 right=145 bottom=40 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 4 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: 3 Letter Words ----- HyperTalk script ----- on Score put the number of lines of field (the number of me) into nLines if nLines > 0 and field "Score" < 2000 then put 50 into base if nLines > 5 then put 5 into nLines add 10*nLines to base add base to field Score end if end Score -- part 24 (field) -- low flags: 00 -- high flags: 4002 -- rect: left=43 top=81 right=146 bottom=80 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 4 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: 4 Letter Words ----- HyperTalk script ----- on Score put the number of lines of field (the number of me) into nLines if nLines > 0 then if nLines > 5 then put 5 into nLines put 100 into base add 20*nLines to base add base to field Score if nLines = 5 and the number of lines of field "3 Letter Words" = 5 and field Score < 2000 then add 300 to field Score end if end if end Score -- part 25 (field) -- low flags: 00 -- high flags: 4002 -- rect: left=83 top=81 right=146 bottom=128 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 4 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: 5 Letter Words ----- HyperTalk script ----- on Score put the number of lines of field (the number of me) into nLines if nLines > 0 then if nLines > 5 then put 5 into nLines put 150 into base add 50*nLines to base add base to field Score if nLines = 5 and the number of lines of field "4 Letter Words" = 5 then add 500 to field Score end if end if end Score -- part 26 (field) -- low flags: 00 -- high flags: 4002 -- rect: left=131 top=81 right=146 bottom=183 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 4 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: 6 Letter Words ----- HyperTalk script ----- on Score put the number of lines of field (the number of me) into nLines if nLines > 0 then if nLines > 5 then put 5 into nLines put 200 into base add 100*nLines to base add base to field Score if nLines = 5 and the number of lines of field "4 Letter Words" = 5 then add 800 to field Score end if end if end Score -- part 27 (field) -- low flags: 00 -- high flags: 4002 -- rect: left=186 top=81 right=146 bottom=250 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 4 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: 7 Letter Words ----- HyperTalk script ----- on Score put the number of lines of field (the number of me) into nLines if nLines > 0 then if nLines > 5 then put 5 into nLines put 350 into base add 150*nLines to base add base to field Score if nLines = 5 and the number of lines of field "4 Letter Words" = 5 then add 1200 to field Score end if end if end Score -- part 28 (field) -- low flags: 00 -- high flags: 4002 -- rect: left=253 top=81 right=146 bottom=324 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 4 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: 8 Letter Words ----- HyperTalk script ----- on Score put the number of lines of field (the number of me) into nLines if nLines > 0 then if nLines > 5 then put 5 into nLines put 500 into base add 250*nLines to base add base to field Score if nLines = 5 and the number of lines of field "4 Letter Words" = 5 then add 1850 to field Score end if end if end Score -- part 29 (field) -- low flags: 00 -- high flags: 4002 -- rect: left=327 top=81 right=146 bottom=410 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 4 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: 9 Letter Words ----- HyperTalk script ----- on Score put the number of lines of field (the number of me) into nLines if nLines > 0 then if nLines > 5 then put 5 into nLines put 500 into base add 500*nLines to base add base to field Score end if end Score -- part 30 (field) -- low flags: 00 -- high flags: 4002 -- rect: left=413 top=81 right=145 bottom=500 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 4 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: 10 Letter Words ----- HyperTalk script ----- on Score put the number of lines of field (the number of me) into nLines if nLines > 0 then if nLines > 5 then put 5 into nLines add 1500*nLines to field Score end if end Score -- part 32 (button) -- low flags: 00 -- high flags: A003 -- rect: left=417 top=265 right=285 bottom=501 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: New Game ----- HyperTalk script ----- on mouseUp global gameState, newWord if the optionKey is down then resetGame else if gameState ≠ "justOpened" and gameState ≠ "gameOver" then --we're in the middle of a game answer "End the current game?" with "Yes" or "Cancel" if it = "Yes" then newGame --we've already inited cards exit mouseUp end if end if repeat with i = 1 to 13 set the hilite of bkgnd button i to false end repeat hide bkgnd button 11 hide bkgnd button 12 hide bkgnd button 13 show field "3 Letter Words" repeat ask "How many players?" with 1 if it is empty then setGameState "justOpened" exit mouseUp end if if it ≥ "0" and it ≤ "9" then exit repeat else answer "Please enter a number." with "OK" end repeat if it > 1 then repeat with i = 1 to it ask "What is the name of player " & i & "?" put it into playerName if i > 1 then set lockscreen to true doMenu "New Card" set the name of this card to "Player" & i end if put playerName into field Username end repeat else ask "What is your name?" put it into field Username end if setGameState "readyToPlay" go card "Player 1" put 0 into field Score end mouseUp -- part 33 (field) -- low flags: 01 -- high flags: 0002 -- rect: left=426 top=291 right=316 bottom=488 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 18 -- style flags: 0 -- line height: 24 -- part name: Timer -- part 34 (field) -- low flags: 01 -- high flags: 0002 -- rect: left=173 top=152 right=171 bottom=303 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 256 -- line height: 16 -- part name: Username -- part 47 (button) -- low flags: 00 -- high flags: A003 -- rect: left=398 top=243 right=263 bottom=501 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Preferences ----- HyperTalk script ----- on mouseUp global gameState if gameState ≠ "gameOver" and gameState ≠ "justOpened" then answer "End the current game?" with "Yes" or "Cancel" if it is "Cancel" then exit mouseUp end if resetGame visual effect zoom out go card "HQ Preferences" end mouseUp -- part 40 (field) -- low flags: 81 -- high flags: 0002 -- rect: left=1 top=78 right=341 bottom=511 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Screen Mask -- part 43 (button) -- low flags: 00 -- high flags: A004 -- rect: left=342 top=222 right=241 bottom=501 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Pause ----- HyperTalk script ----- on mouseUp global gameState, secsOffset, pauseOffset if gameState = "clockRunning" then if the name of bkgnd button (the number of me) contains "Pause" then show field "Screen Mask" set the name of bkgnd button (the number of me) to "Resume" put the secs into pauseOffset else hide field "Screen Mask" set the name of bkgnd button (the number of me) to "Pause" add (the secs - pauseOffset) to secsOffset end if end if end mouseUp -- part 48 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=470 top=39 right=68 bottom=502 -- title width / last selected line: 0 -- icon id / first selected line: 2478 / 2478 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: About ----- HyperTalk script ----- on mouseUp global gameState if gameState ≠ "gameOver" and gameState ≠ "justOpened" then answer "End the current game?" with "Yes" or "Cancel" if it is "Cancel" then exit mouseUp end if resetGame go card "Welcome" end mouseUp -- part 50 (button) -- low flags: 00 -- high flags: 8002 -- rect: left=5 top=188 right=206 bottom=302 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Press Return to start a new game